package com.disapand.strongarmy.model

import org.ktorm.database.*
import org.ktorm.entity.*
import org.ktorm.schema.*

/**
 *
 * @auth disapand
 * @date 2021/10/19 - 16:20 - 星期二
 *
 */
interface Role : BaseModel, Entity<Role> {
    companion object: Entity.Factory<Role>()

    var label: String
    var role: String
}

object Roles : Table<Role>("sa_role") {
    val id = int("id").primaryKey().bindTo { it.id }
    val label = varchar("label").bindTo { it.label }
    val role = varchar("role").bindTo { it.role }
    val status = int("status").bindTo { it.status }
    val deleted = boolean("deleted").bindTo { it.deleted }
    val createdBy = int("created_by").bindTo { it.createdBy }
    val createdAt = datetime("created_at").bindTo { it.createdAt }
    val updatedBy = int("updated_by").bindTo { it.updatedBy }
    val updatedAt = datetime("updated_at").bindTo { it.updatedAt }
}

val Database.roles get() = this.sequenceOf(Roles)